export function importDialog() {
  return [
    {
      label: '导入文件',
      prop: 'film_zip',
      component: 'UploadFile',
      params: {
        maxSize: '100M',
        multiple: true,
        fileTypes: ['zip'],
        ty: 'local',
      },
    },
  ]
}

export function allDialogForm() {
  const validateWeight = (rule, value, callback) => {
    if (value === undefined) {
      callback(new Error('请输入权重'))
    }
    if (value > 1000 || value < 0) {
      callback(new Error('权重范围:0-1000'))
    }
    callback()
  }
  return [
    {
      label: '影片名称',
      prop: 'name',
      rules: [
        {
          required: true,
          message: '请输入影片名称',
        },
      ],
    },
    {
      label: '影片总集数',
      prop: 'episodes',
      rules: [
        {
          required: true,
          message: '请输入影片总集数',
        },
      ],
    },
    {
      filterable: true,
      type: 'select',
      label: '影片分类',
      prop: 'film_category_id',
      dicData: this.movieTypeList,
      rules: [
        {
          required: true,
          message: '请输入影片分类',
        },
      ],
    },
    {
      label: '语言',
      prop: 'language',
      rules: [
        {
          required: true,
          message: '请输入语言',
        },
      ],
    },
    {
      label: '合作平台',
      prop: 'cooperation_platform',
      rules: [
        {
          required: true,
          message: '请输入合作平台',
        },
      ],
    },
    {
      label: '导演',
      prop: 'director',
    },
    {
      type: 'select',
      label: '状态',
      prop: 'status',
      dicData: [
        { value: 1, label: '待上架' },
        { value: 2, label: '已上架' },
      ],
      props: {
        label: 'label',
        value: 'value',
      },
      rules: [
        {
          required: true,
          message: '请输入状态',
        },
      ],
    },
    {
      label: '作家',
      prop: 'author',
    },
    {
      type: 'select',
      multiple: true,
      label: '上架国家',
      prop: 'country_id_list',
      filterable: true,
      dicData: [{ id: -1, full_name: '所有国家', short_name: 'All' }, ...this.countryList],
      props: {
        label: 'full_name',
        value: 'id',
      },
      typeformat(row) {
        return `(${row?.short_name})${row?.full_name}`
      },
      rules: [
        {
          required: true,
          message: '请选择上架国家',
        },
      ],
    },
    {
      label: '主演',
      prop: 'main_actor',
    },
    {
      filterable: true,
      multiple: true,
      type: 'select',
      label: '营销关键字',
      prop: 'keywords',
      dicData: this.keyWordList,
      props: {
        label: 'name',
        value: 'id',
      },
      rules: [
        {
          required: true,
          message: '请选择营销关键字',
        },
      ],
    },
    {
      type: 'number',
      label: '权重',
      prop: 'weight',
      rules: [
        {
          required: true,
          validator: validateWeight,
        },
      ],
    },
    {
      label: '资源域名地址',
      prop: 'host',
      rules: [
        {
          required: true,
          message: '请输入域名地址',
        },
      ],
    },

    {
      label: '影片海报',
      prop: 'image',
      component: 'UploadImage',
      params: {
        maxSize: 51200,
        multiple: false,
        ty: 'oss',
      },
      rules: [
        {
          required: true,
          message: '请选择影片海报',
        },
      ],
    },
    {
      type: 'textarea',
      label: '简介  ',
      prop: 'description',
      rules: [
        {
          required: true,
          message: '请输入简介',
        },
      ],
    },
  ]
}
